package exeption;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class FinallDemo2 {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos =null;
        try {
            fos =new FileOutputStream("fos.dat");
        } catch (FileNotFoundException e) {
            fos.write(1);
        }finally {
            try {
                if (fos!=null){
                    fos.close();
                }
            }catch (IOException e){
                e.printStackTrace();
            }
        }
    }
}
